#include "Fighter.h"

Fighter::Fighter ()
{

}
Fighter::~Fighter ()
{

}

void Fighter::Load ()
{
	mSprite.Load ("fighter.png");
}
void Fighter::Render ()
{
	const int width = mSprite.GetWidth ();
	const int height = mSprite.GetHeight ();
	SVector2 offset ((width * 0.5f), (height * 0.5f));
	SVector2 renderPosition = mPosition - offset;

	mSprite.SetPosition (renderPosition);
	mSprite.Render ();
}
void Fighter::Unload ()
{
	mSprite.Unload ();
}
void Fighter::Update (float deltaTime)
{
	const float kSpeed = 300.0f;
	const int kWinWidth = IniFile_GetInt ("WinWidth", 800);
	const int kWinHeight = IniFile_GetInt ("WinHeight", 600);

	if (Input_IsKeyDown (Keys::RIGHT))
	{
		mPosition.x += (kSpeed * deltaTime);

		if (mPosition.x >= kWinWidth)
		{
			mPosition.x = 0.0f;
		}
	}
	else if (Input_IsKeyDown (Keys::LEFT))
	{
		mPosition.x -= (kSpeed * deltaTime);

		if (mPosition.x <= 0.0f)
		{
			mPosition.x = kWinWidth;
		}
	}

	if (Input_IsKeyDown (Keys::UP))
	{
		mPosition.y -= (kSpeed * deltaTime);

		if (mPosition.y <= 0.0f)
		{
			mPosition.y = kWinHeight;
		}
	}
	else if (Input_IsKeyDown (Keys::DOWN))
	{
		mPosition.y += (kSpeed * deltaTime);

		if (mPosition.y >= kWinHeight)
		{
			mPosition.y = 0.0f;
		}
	}
}